package com.mhl.service;

import com.mhl.dao.DiningTableDao;
import com.mhl.domain.DiningTable;

import java.util.List;

public class DiningTableService {

    DiningTableDao diningTableDao = new DiningTableDao();

    public List<DiningTable> getDiningTable(){

        return diningTableDao.queryMulti("select id,state from diningTable",DiningTable.class);

    }
    public boolean orderDiningTable(int id,String orderName,String orderTel){
        int update =
                diningTableDao.update("update diningTable set state='已经预定',orderName=?,orderTel=? where id = ?;",orderName,orderTel,id);
        return update>0;
    }

    public DiningTable getDiningTableById(int id) {
        return diningTableDao.querySingle("select * from diningTable where id=?",DiningTable.class,id);

    }
}
